﻿using pingjia.bll;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class views_customer_Register : System.Web.UI.Page
{
    ConsumerService c = new ConsumerService();
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Unnamed2_Click(object sender, EventArgs e)
    {
        Response.Redirect("../Login.aspx");

    }

    protected void Unnamed1_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            //调用CustomerService类中的IsNameExist()方法判断用户名是否重名
            if (c.IsNameExist(txtName.Text.Trim()))
            {
                Response.Write("<script>alert('用户已存在！')</script>");

            }
            else
            {
                //调用CustomerService类中的Insert()方法插入新用户记录
                c.Insert(txtName.Text.Trim(), txtPwd1.Text.Trim(), txtEmail.Text.Trim(), int.Parse(Age.Text.Trim()), iphone.Text.Trim());
                Response.Redirect("../Login.aspx?name=" + txtName.Text);
            }
        }
    }

    

}